<?php
/**
 * Created by PhpStorm.
 * User: shaowei
 * Date: 2022/8/31
 * Time: 14:18
 */

namespace App\Datas;

use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
use mysql_xdevapi\Table;

class OpusReptile
{

    public function getCout($lid) {
        return DB::table('opus_reptile')->where(['lid'=>$lid])->count();
    }

//`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
//`lid` varchar(64) DEFAULT NULL,
//`prompt` varchar(2048) DEFAULT NULL,
//`url` varchar(1024) DEFAULT NULL,
//`verify` tinyint(4) NOT NULL DEFAULT '0',
//`width` int(11) NOT NULL DEFAULT '512',
//`height` int(11) NOT NULL DEFAULT '512',
    public function insertData($lid,$prompt,$url,$width,$height) {
        DB::table('opus_reptile')->insert([
            'lid' => $lid,
            'prompt' => $prompt,
            'url' => $url,
            'width' => $width,
            'height' => $height
        ]);
    }


    public function getWords() {
        return DB::table('opus_reptile_word')->where(['used'=>0])->get();
    }

    public function updateWordUsed($id) {
        DB::table('opus_reptile_word')->where(['id'=>$id])->update(['used'=>1]);
    }

}